' def fnCTICKS.def -- returns the number of clock ticks since midnight
'
'       Allows the caller to `mark' the time, with an optional offset
'       ahead in time.  Useful in timing routines
'
' USAGE:
'       HUN.SCNDS = 100
'       MARK! = FNCTICKS (HUN.SCNDS)  ' # of clock ticks that will
'                    'have occurred since midnite (in 1 sec. from now)
'
'input: HUN.SCNDS = hundredths of seconds from now
'output: TIME.MARK! = time marker calculated (clock ticks since midnight)
'

def fncticks! (hun.scnds!)
	'$include: 'TICKS.def'
	'$DYNAMIC
	dim registers%(7)
	registers%(0) = 0       'set AH (& AL) to 0 to get clock setting
	call int86 (&h1a,varptr(registers%(0)),varptr(registers%(0)))
	cx!=registers%(2) :dx!=registers%(3)
	cticks! = (cx!*2^16 + dx!) + (hun.scnds!/100*ticks.per.sec!)
	if cticks!>ticks.per.day! then cticks!=cticks!-ticks.per.day!  'passed midnite
	fncticks!=fix(cticks!)
	erase registers%
end def


